using System;
using System.Collections.Generic;
using System.Text;

namespace XMLStuffs
{
    public class Thread
    {

        // Variables
        public int ID;
        public String Board;
        public Dictionary<int, Post> Posts;

        // Constructor
        public Thread(int _ID, String _Board)
        {

            // .. 
            ID = _ID;
            Board = _Board;

            // Dictionary
            Posts = new Dictionary<int, Post>();

        }
        public Thread()
        {

            // Dictionary
            Posts = new Dictionary<int, Post>();

        }

        // Add post
        public void AddPost(Post _Post)
        {

            // Exist in dictionary?
            if (!Posts.ContainsKey(_Post.ID))
            {

                // Add
                Posts.Add(_Post.ID, _Post);

            }
            else
            {

                // Exception
                throw new Exception("Post [" + _Post.ID.ToString() + "] already in thread.");

            }

        }

    }
}
